id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

String Operationsslice2

prev  |  next  |  chance

The last character in a string is at index -1.

def slice2(s):
    c = s[-1]
    return c
Function Call  Return Value
slice2('Car')
slice2('Truck')
slice2('55684')
slice2('Elephant')
slice2('Roses')

Experiment with this code on Gitpod.io

⬅ Back